﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;

namespace ESLReminder.Games
{
    public class GameWarcraft3 : GameModule
    {
        public GameWarcraft3()
            : base(new PluginInfo("Warcraft III",
             new Version(1, 0),
             "©2009 Lucas Romero",
             "http://code.google.com/p/quicktools/"))
        {

        }
        public override string ProcessName
        {
            get { return "war3"; }
        }
        protected override bool isGameInternal(System.Diagnostics.Process proc)
        {
            bool isGame = proc.ProcessName == ProcessName;
            if (!isGame)
                return false;
            try
            {
                // give us debug privileges, required for OpenProcess() on warcraft 3
                Process.EnterDebugMode();
            }
            catch (Exception ex)
            {
                Trace.WriteLine("EnterDebugMode() failed: " + ex.Message);
            }
            return true;
        }
        public override void ProcessStarted(System.Diagnostics.Process proc)
        {
            try
            {
                // give us debug privileges, required for OpenProcess() on warcraft 3 for example
                Process.EnterDebugMode();
            }
            catch (Exception ex)
            {
                Trace.WriteLine("EnterDebugMode() failed: " + ex.Message);
            }
            base.ProcessStarted(proc);
        }
    }
}
